Private Type KeyboardBytes
    kbByte(0 To 255) As Byte
End Type
Declare Function GetKeyboardState Lib "user32" (pbKeyState As KeyboardBytes) As Long
Sub test()
    Dim kbarray As KeyboardBytes
    GetKeyboardState kbarray
    MsgBox "caps lock=" & kbarray.kbByte(20)
    MsgBox "num lock=" & kbarray.kbByte(144)
    MsgBox "scroll lock=" & kbarray.kbByte(145)
End Sub